package service

import (
	"gogogo-server/gameserver/global"
	"gogogo-server/gameserver/model"
	"log"
)

type Manager struct {
	playerService *GenericService[model.Player]
}

func (m *Manager) GetPlayerService() *GenericService[model.Player] {
	if m.playerService == nil {
		m.playerService = NewGenericService[model.Player]()
	}
	return m.playerService
}
func RegisterTables() {
	db := global.GGG_DB
	err := db.AutoMigrate(
		model.User{},
		model.Player{},
	)
	if err != nil {
		log.Println("register table failed")
		return
	}
	log.Println("register table success")
}

var DataService = &Manager{}
